<?php
class View_Admin_Index_Template extends MVC_VIEW {
	public $oTemp;
	public function __construct($oModel){
		$this->initTemplate($oModel);
	}
	public function initTemplate($oModel){
		global $sModule, $sFile;
		
		$this->setTemplate(PATH_TEMPLATE_ADMIN . "html/index.html");
		$this->oTemp->assign_file( 'tempFooter', PATH_TEMPLATE_ADMIN.'html/temp_footer.html' );
                if(MODE == "FO"){
                    $this->oTemp->assign_file( 'tempMenuNav', PATH_TEMPLATE_ADMIN.'html/temp_menu.html' );
                }
                else{
                    $this->oTemp->assign_file( 'tempMenuNav', PATH_TEMPLATE_ADMIN.'html/temp_menu_bo.html' );
                }
		/*
		if(getUserRole()==1)
		{
			$this->oTemp->assign_file( 'tempMenuNav', PATH_TEMPLATE_ADMIN.'html/temp_menu.html' );
		}
		else
		{
			$this->oTemp->assign_file( 'tempMenuNav', PATH_TEMPLATE_ADMIN.'html/temp_menu_for_staff.html' );
		}
		*/
		$this->oTemp->assign_file( 'tempPathway', PATH_TEMPLATE_ADMIN.'html/temp_pathway.html' );
		$this->oTemp->assign_file( 'tempToolbar', PATH_TEMPLATE_ADMIN.'html/temp_toolbar.html' );
		$this->oTemp->assign_file( 'tempJsRequire', PATH_TEMPLATE_ADMIN.'html/temp_js.html' );
		
		/**
		 * TRANSLATE
		 */
		$sFileLanguage = PATH_INCLUDE."ini/language/".FOLDER_LANGUAGE."index.ini";
		
		$this->translate($sFileLanguage);
		
		
		$oModel->oLang = new MVC_Read_ini();
		$oModel->oLang->set_file($sFileLanguage);
		$oModel->aLanguage = $this->oLang->parse();
		/**
		 * 
		 */
		if($oModel->aLanguage['MENU'][$sModule] != ""){
			$sModuleName = $oModel->aLanguage['MENU'][$sModule];
		}else{
			$sModuleName = $sModule;
		}
		
		if($oModel->aLanguage['FORM'][$sFile] != ""){
			$sFileName = $oModel->aLanguage['FORM'][$sFile];
		}else{
			$sFileName = $sFile;
		}
		
		$this->oTemp->assign('sModule',$sModule);
		$this->oTemp->assign('pathway_module',$sModuleName);
		$this->oTemp->assign('pathway_file',$sFileName);
		$this->oTemp->assign('admin_username',$_SESSION['admin_username']);
		
	}

	
	public function displayPage($oModel){
		$this->oTemp->assign('sErrorMsg',$oModel->getErrorMsg());
		$this->oTemp->assign('sMsg',$oModel->getMsg());
		/**
		 * ASSIGN REQUEST ITEM
		 */
		$aDataRequest = $oModel->getAllData();
		$this->assignExtract($aDataRequest);
		/**
		 * 
		 */
		$this->oTemp->parse('main');
		$this->printHTML('main');
	}
	
	public function displayMenuNav($oModel){
		
	}
}
